import { homeCategoryHeadApi } from '@/api/category'

const state={
  //分类数据
  list:[
    {name:'居家',id:1},
    {name:'美食',id:2},
    {name:'服饰',id:3},
    {name:'母婴',id:4},
    {name:'个护',id:5},
    {name:'严选',id:6},
    {name:'数码',id:7},
    {name:'运动',id:8},
    {name:'杂项',id:9},
  ]
}
const mutations={
  setList(state,payload){
    state.list = payload
  }
}
const actions={
 async getList({ commit }){
  const res = await  homeCategoryHeadApi()
   // console.log(res)
   commit('setList',res.result)
  }
}
const getters={}
export default {
  namespaced:true,
  state,
  mutations,
  actions,
  getters
}
